//
//  DeviceAddView.m
//  sentorise
//
//  Created by admin on 2025/8/25.
//

#import "DeviceAddView.h"
#import "DeviceScanViewController.h"
#import "DeviceSearchListView.h"
#import "GlobalDefine.h"

@interface DeviceAddView()

@property (nonatomic, strong) UINavigationController *nav;
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
@property (weak, nonatomic) IBOutlet UILabel *itemTitleLabel1;
@property (weak, nonatomic) IBOutlet UILabel *itemTitleLabel2;

@end

@implementation DeviceAddView

+ (void)show:(UINavigationController *)nv {
    DeviceAddView *view = (DeviceAddView *)[[[NSBundle mainBundle] loadNibNamed:@"DeviceAddView" owner:self options:nil] firstObject];
    view.frame = [[UIScreen mainScreen] bounds];
    view.nav = nv;
    view.titleLabel.text = NSLocalizedString(@"Add device", nil);
    view.itemTitleLabel1.text = NSLocalizedString(@"Scan QR Code", nil);
    view.itemTitleLabel2.text = NSLocalizedString(@"Search via Bluetooth", nil);
    [[UIApplication sharedApplication].delegate.window addSubview:view];
}

- (IBAction)actionScan:(id)sender {
    [self removeFromSuperview];
    DeviceScanViewController *vc = [[DeviceScanViewController alloc] initWithNibName:@"DeviceScanViewController" bundle:nil];
    [self.nav pushViewController:vc animated:YES];
}

- (IBAction)actionSearch:(id)sender {
    [self removeFromSuperview];
    [DeviceSearchListView show:self.nav];
}

- (IBAction)actionClose:(id)sender {
    [self removeFromSuperview];
    [[NSNotificationCenter defaultCenter] postNotificationName:kBTAddViewDismiss object:nil];
}


@end
